/**
 * Definition for singly-linked list.
 * type ListNode struct {
 *     Val int
 *     Next *ListNode
 * }
 */
func swapPairs(head *ListNode) *ListNode {
    var dummyNode *ListNode
    dummyNode = &ListNode{Next:head}
    preNode := dummyNode
    curNode := head
    for curNode != nil && curNode.Next != nil {
        tem := curNode.Next.Next
        preNode.Next = curNode.Next
        curNode.Next.Next = curNode
        curNode.Next = tem
        
        preNode = preNode.Next.Next
        curNode = curNode.Next
    }
    return dummyNode.Next
}